# import requests
# class IhrmLoginApi:
#     @classmethod
#     def login(cls,data):
#         url = 'http://ihrm2-test.itheima.net/api/sys/login'
#         headers = {'Content-Type':'application/json'}
#         # data = {'mobile':'13800000002','password':'123456'}
#
#         r = requests.post(url=url,headers =headers,json=data)
#         return r

#
#
#     @classmethod
#     def add(cls,data,token):
#         url= 'http://ihrm2-test.itheima.net/api/sys/user'
#         headers = {'Content-Type': 'application/json','Authorization':token}
#         r1 = requests.post(url,headers=headers,json=data)
#         return r1
#
#
#
#     @classmethod
#     def delete(cls,token,id):
#         url = f'http://ihrm2-test.itheima.net/api/sys/user/{id}'
#         headers = {'Content-Type': 'application/json', 'Authorization': token}
#         r2 = requests.delete(url, headers=headers)
#         return r2
#
#
# -------------------------------------------------------------------------------------------


#
# import requests
# class IHRMAPI:
#     @classmethod
#     def login(cls,data):
#         url = 'http://ihrm2-test.itheima.net/api/sys/login'
#         headers = {'Content-Type': 'application/json'}
#         r = requests.post(url=url,headers= headers,json=data)
#         return r

# --------------------------------------------------------------------------------

# import requests
# # class IHRMADD:
#     @classmethod
#     def ihrm_add(cls,data,token):
#         url = 'http://ihrm2-test.itheima.net/api/sys/user'
#         headers = {'Content-Type': 'application/json','Authorization': token}
#         r= requests.post(url,headers = headers,json=data)
#         return r
# -----------------------------------------------------------------------------------
# import requests
# class IHRMAPI:
#     @classmethod
#     def login(cls,data):
#         url = 'http://ihrm2-test.itheima.net/api/sys/login'
#         headers = {'Content-Type':'application/json'}
#         r = requests.post(url,headers = headers,json=data)
#         return r
#
#
#     @classmethod
#     def add(cls,data,token):
#         url = 'http://ihrm2-test.itheima.net/api/sys/user'
#         headers = {'Content-Type': 'application/json','Authorization': token}
#         r= requests.post(url,headers = headers,json=data)
#         return r
#
#     @classmethod
#     def delete(cls,token,id):
#         url = f'http://ihrm2-test.itheima.net/api/sys/user/{id}'
#         headers = {'Content-Type': 'application/json', 'Authorization': token}
#         r = requests.delete(url,headers=headers)
#         return r
# -----------------------------------------------------------------------------------------
#
import logging

import requests
class IHRMAPI:
    @classmethod
    def login(cls,data):
        url = 'http://ihrm2-test.itheima.net/api/sys/login'
        headers = {'Content-Type':'application/json'}
        r = requests.post(url,headers = headers,json=data)
        # logging.info(r.json())
        return r


    @classmethod
    def add(cls,data,token):
        url = 'http://ihrm2-test.itheima.net/api/sys/user'
        headers = {'Content-Type': 'application/json','Authorization': token}
        r= requests.post(url,headers = headers,json=data)
        return r

    @classmethod
    def delete(cls,id,token):
        url = f'http://ihrm2-test.itheima.net/api/sys/user/{id}'
        headers = {'Content-Type': 'application/json', 'Authorization': token}
        r = requests.delete(url,headers=headers)
        return r


















